package com.magic.disney.aspect;

import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;


@Aspect
@Component
public class LogAspect {

    private final Logger logger= LoggerFactory.getLogger(this.getClass());

    //定义切面
    @Pointcut("execution(* com.magic.disney.web.*.*(..))")
    public void log(){

    }

    @Before("log()")
    public void doBefore(){
        logger.info("-----------doBefore---------");

    }

    @After("log()")
    public void doAfter(){
        logger.info("---------doAfter----------");
    }

    /*拦截方法*/
    @AfterReturning(returning = "result",pointcut = "log()")
    public void doAfterReturn(Object result){
        logger.info("Result:{ }"+result);
    }

}


